Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(2911): add validations on resolvers for federation #2916

Conversation

dekkku
Copy link
Contributor

@dekkku dekkku commented Sep 26, 2024

Summary:
Briefly describe the changes made in this PR.

Issue Reference(s):
/claim #2911
Fixes #2911

Build & Testing:

  • I ran cargo test successfully.
  • I have run ./lint.sh --mode=fix to fix all linting issues raised by ./lint.sh --mode=check.

Checklist:

  • I have added relevant unit & integration tests.
  • I have updated the documentation accordingly.
  • I have performed a self-review of my code.
  • PR follows the naming convention of <type>(<optional scope>): <title>

@github-actions github-actions bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Sep 26, 2024
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

Attention: Patch coverage is 96.36364% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.85%. Comparing base (9f184fe) to head (a833c58).
Report is 87 commits behind head on main.

Files with missing lines Patch % Lines
src/core/blueprint/operators/apollo_federation.rs 96.36% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2916      +/-   ##
==========================================
+ Coverage   87.84%   87.85%   +0.01%     
==========================================
  Files         263      263              
  Lines       26252    26301      +49     
==========================================
+ Hits        23061    23108      +47     
- Misses       3191     3193       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Oct 1, 2024

Action required: PR inactive for 5 days.
Status update or closure in 10 days.

@github-actions github-actions bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label Oct 1, 2024
Comment on lines +80 to +101
Resolver::Http(http) => {
Valid::from_iter(http.query.iter(), |query| {
let mustache = Mustache::parse(&query.value);
validate_expressions(type_name, config_module, mustache.segments().iter())
})
.and_then(|_| {
let mustache = Mustache::parse(&http.path);
validate_expressions(type_name, config_module, mustache.segments().iter())
})
.and(validate_iter(
config_module,
type_name,
http.batch_key.iter(),
))
.and(compile_http(
config_module,
http,
// inner resolver should resolve only single instance of type, not
// a list
false,
))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to parse templates and extract keys again because it's already done in the src/core/config/transformer/subgraph.rs transformer. Also there is handler to http resolver only.

Consider making changes there the way that after Keys are calculated we add additional validation step that will check that entries are part of the currently processed type


```graphql @config
schema
@server(port: 8000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@server(port: 8000)
@server(port: 8000, enableFederation: true)

It's required now to enable the subgraph functionality

@meskill meskill marked this pull request as draft October 7, 2024 11:54
@github-actions github-actions bot removed the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label Oct 7, 2024
Copy link

Action required: PR inactive for 5 days.
Status update or closure in 10 days.

@github-actions github-actions bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label Oct 12, 2024
Copy link

PR closed after 10 days of inactivity.

@github-actions github-actions bot closed this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 Bounty claim state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Federation Subgraph: add validation for used fields
2 participants